//ShapeCont.h - Class Shape Container

#ifndef _SHAPECONT_H_
#define _SHAPECONT_H_

#include <vector>
#include "Shape.h"
#include "Rect.h"
#include "Circle.h"
#include "Point.h"

using namespace std;

class ShapeCont
{
private:
	//data members
	vector<Shape*> m_vec;	//stl vector for shapes, contains all the shapes

	bool isLegalIndex(unsigned int index) const	//checks if the index exists in the vector
		{return (index >= 0 && index <  m_vec.size()) ? true : false;};
public:
	ShapeCont() {};	//empty constructor
	
	unsigned int getSize() const { return m_vec.size(); };
	Shape* getShape(const unsigned int index);	//get pointer to shape acording to an index
	Shape* getShape(const Point& point);	//get pointer to shape acording to a point
	unsigned int getIndexByPoint(const Point& point); //returns the index of the shape that declared by a point 

	void addShapeToBack(Shape* shape) { m_vec.push_back(shape); };	//adds a shape to the end (back) of the vector
	bool removeShape(const unsigned int index);	//deletes a shape from the vector by index
	bool removeShapeFromBack(); //delete the shape in the end (back) of the vector
	bool moveShapeToBack(const unsigned index);	//brigns a shape that is recognized by index to the back (end)
	void drawAll(char ch, bool isFullFill) const; //draws all the shapes to the screen
	bool drawAllWithOneSpecial(char ch, bool isFullFill, unsigned int idxSpecial, char chSpecial) const; //draws all shapes to the scrren and one special (the selected one) with other char
	int findShapeWithPointInside(const Point& point); //finds the index of the shape that include a point , if there is no one returns -1
	bool moveShapeToFront(const unsigned index); //move shape to the begining of the vector (front)
	bool moveShape(const unsigned int index, int incX, int incY);	//move shape by moving its point
	void execShifts();
	void resetMovementParms();
	void execShiftsWithColiisions();
	void drawAllToBuffer(char ch, bool isFullFill, bool isSplit, Screen& scr);
	ShapeCont(const ShapeCont& shapeCont); //copy constructor
	~ShapeCont();	//destructor - delete all the shapes
};

#endif